import requests
import json

def test_api():
    url = "https://www.energylabel.com.cn/admin-api/gateway/productRegistration/productRegistrationList"
    
    # Start with an empty payload, or a basic one with pagination
    payload = {
        "pageNum": 1,
        "pageSize": 10,
        "id": "cascader-menu-575-1-4"
    }
    
    headers = {
        'Content-Type': 'application/json;charset=UTF-8',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
    }
    
    try:
        response = requests.post(url, headers=headers, data=json.dumps(payload))
        response.raise_for_status()  # Raise an exception for bad status codes
        
        print("Status Code:", response.status_code)
        print("Response JSON:", response.json())
        
    except requests.exceptions.RequestException as e:
        print(f"An error occurred: {e}")
    except json.JSONDecodeError:
        print("Failed to decode JSON from response:")
        print(response.text)

if __name__ == "__main__":
    test_api() 